#ifndef LoggerWrap_h
#define LoggerWrap_h
#include "lua.hpp"
#include "render_v1.h"

namespace hxe
{
    static int print(lua_State *L) {
        const char *s = lua_tostring(L, -1);
        if (s != nullptr)
        {
            LoggerInst->print(s);
        }
        else
        {
            LoggerInst->print("print nil");
        }
        return 0;
    }

    static const luaL_Reg funcs[] = {
      {"print", print},
      {nullptr, nullptr}
    };

    class LoggerWrap
    {
        public:
            static int openLib(lua_State *L)
            {
                luaL_newlib(L, funcs);
                return 1;
            }
    };
};

#endif